home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / CONTRSRC.ZIP / SRC / MISC / MCHDETEC.ASM < prev    next >
Encoding:
Assembly Source File  |  1994-09-28  |  3.5 KB  |  116 lines

  1. ;**********************************************
  2. ; MCH DETECT (C) 1994 Type One / TFL-TDV Prod.
  3. ;**********************************************
  4.  
  5. ;-----------------------------------------
  6. ; Déclaration modèle mémoire
  7. .386
  8. DGROUP GROUP _DATA,_BSS
  9. _TEXT  SEGMENT DWORD PUBLIC USE16 'CODE'
  10.        ASSUME CS:_TEXT,DS:DGROUP
  11. _TEXT  ENDS
  12. _DATA  SEGMENT DWORD PUBLIC USE16 'DATA'
  13. _DATA  ENDS
  14. _BSS   SEGMENT DWORD PUBLIC USE16 'BSS'
  15. _BSS   ENDS
  16. ;-----------------------------------------
  17.  
  18. _DATA SEGMENT
  19.  
  20. Sorry   BYTE 10,13,'Sorry Dude, You must have VGA card to see dis Demo...',10,13,'$'
  21. Sorry2  BYTE 10,13,'Sorry, You must have a 386+ to run dis Demo properly !!!',10,13,'$'
  22.  
  23. _DATA ENDS
  24.  
  25. _TEXT SEGMENT
  26.              PUBLIC _MCH_Detect
  27.  
  28. EXIT    MACRO        ; ""
  29.         mov ax,4c00h
  30.         int 21h
  31.         ENDM
  32.  
  33. MPUSH   MACRO reg1:REQ,reg2:VARARG   ; Vive Y.Roggeman/Greg & ses Macros
  34.         push reg1                    ; recursives !!!!!!! yahouuuuu !!!
  35.         IFNB <reg2>
  36.         MPUSH reg2
  37.         ENDIF
  38.         ENDM
  39.  
  40. MPOP    MACRO reg1:REQ,reg2:VARARG   ; bis bis !!!
  41.         IFNB <reg2>                  ; type brol = record....
  42.         MPOP reg2                    ; donc ça fait 20 bytes !!!
  43.         ENDIF                        ; donc 1 word ....
  44.         pop reg1                     ; brol je dis struct !!!
  45.         ENDM
  46.  
  47. ;==============================================================================
  48. ALIGN 
  49. EVEN
  50. _MCH_Detect PROC FAR    ; dispose-t-on d'une machine convenable ???
  51.  
  52. .8086
  53.          push    bp
  54.          mov     bp,sp
  55.          MPUSH   ax,bx,cx,dx,si,di,ds,es
  56.  
  57.          mov     WORD PTR cs:[Save_BP+1],bp
  58.  
  59. ;-------- Routine de détection ---------
  60.          xor     bx,bx                ;- VGA Detect -
  61.          mov     ax,01a00h
  62.          int     10h
  63.          cmp     bl,7
  64.          jc      @F
  65.          cmp     bl,00dh
  66.          jc      VGA_Ok
  67. @@:      lea     dx,Sorry             ; Sorry You've not...
  68.          mov     ah,9
  69.          int     21h
  70.          EXIT
  71. VGA_Ok:                               ;- Processor Detect - (C) Bible PC
  72.          xor     ax,ax                ; Fixer AX sur 0
  73.          push    ax                   ; et placer sur la pile
  74.          popf                         ; Retirer de la pile comme reg. de flags
  75.          pushf                        ; Replacer sur la pile
  76.          pop     ax                   ; et ramener dans AX
  77.          and     ax,0f000h            ; Annuler tous les bits sauf les 4 sup.
  78.          cmp     ax,0f000h            ; bits 12 à 15 sont-ils tous à 1 ?
  79.          je      @F                   ; --> Beurk XT : EXIT
  80.          mov     ax,07000h            ; 286 ou 386
  81.          push    ax                   ; Placer la valeur 07000h sur la pile
  82.          popf                         ; Retirer comme registre de flags
  83.          pushf                        ; et replacer sur la pile
  84.          pop     ax                   ; Ramener dans le registre AX
  85.          and     ax,07000h            ; Masquer tous les bits sauf 12 à 14
  86.          jne     pc386_Ok             ; --> Ok 386
  87. @@:      lea     dx,Sorry2            ; désolé....
  88.          mov     ah,9
  89.          int     21h                  ; rem: détection inhibe les interruptions
  90.          sti
  91.          EXIT
  92.  
  93. pc386_Ok:
  94.          sti
  95.  
  96. Save_BP  LABEL WORD
  97.          mov     bp,1234h
  98.  
  99.          MPOP    ax,bx,cx,dx,si,di,ds,es
  100.          mov     sp,bp
  101.          pop     bp
  102.  
  103.          retf
  104.  
  105. _MCH_Detect ENDP
  106.  
  107.  
  108. _TEXT ENDS
  109.  
  110.          END
  111.  
  112.  
  113.  
  114.  
  115.  
  116.